import { defineConfig, globalIgnores } from 'eslint/config'
import globals from 'globals'
import js from '@eslint/js'
import pluginVue from 'eslint-plugin-vue'
import skipFormatting from '@vue/eslint-config-prettier/skip-formatting'

export default defineConfig([
  {
    name: 'app/files-to-lint',
    files: ['**/*.{js,mjs,jsx,vue}'],
  },

  globalIgnores(['**/dist/**', '**/dist-ssr/**', '**/coverage/**']),

  {
    languageOptions: {
      globals: {
        ...globals.browser,
        rules: {
          // 允许组件名使用单单词（包括 "Index"）
          'vue/multi-word-component-names': 'off',

          // 如果还有关于 "index" 文件名的特定规则限制，也可以关闭
          // 例如某些自定义规则或其他插件的规则
          // 'your-plugin/index-must-be-multi-word': 'off'
        },
      },
    },
  },

  js.configs.recommended,
  ...pluginVue.configs['flat/essential'],
  skipFormatting,
])
